schedule("menu", menuInit); 

var menuDelay = null;
var menuDelayTarget = null;
var isIE = false;

if (document.all && typeof window.opera == "undefined")
{
	isIE = true;
}





function menuInit()
{

	var menu = document.getElementById("menu");
	var menuList = getChildrenByTagName(menu, "ul")[0];
	var listItems = getChildrenByTagName(menuList, "li");
	
	for (var i = 0; i < listItems.length; i++)
	{
		if (listItems[i].className.indexOf("dropdown") != -1)
		{
		
			listItems[i].onmouseover = showMenu1;
			listItems[i].onmouseout = hideMenu1;
		}
	}
	
	return true;
}




function showMenu1()
{
	var subList = this.getElementsByTagName("ul")[0];
	var siblings = getChildrenByTagName(this.parentNode, "li");
	//var shadow = document.getElementById("shadow");
	
	for (var i = 0; i < siblings.length; i++)
	{
		if (siblings[i] != this)
		{
			hideMenuDelayed(siblings[i]);
		}
	}

	if (menuDelayTarget != null)
	{
		clearTimeout(menuDelay);
	}
	
	if (typeof this.originalClass == "undefined")
	{
		this.originalClass = this.className;
	}

	this.className = this.className.addClass("hover");

	/*if (shadow == null)
	{
		if (isIE)
		{
			shadow = document.getElementsByTagName("body")[0].appendChild(document.createElement("iframe"));
		}
		else
		{
			shadow = document.getElementsByTagName("body")[0].appendChild(document.createElement("div"));
		}
		
		shadow.id = "shadow";
	}
	
	try
	{
		var parent = subList.offsetParent;
		var totalLeft = subList.offsetLeft;
		var totalTop = subList.offsetTop;
		
		while (parent != null)
		{
			totalLeft += parent.offsetLeft;
			totalTop += parent.offsetTop;
			
			if (!isIE)
			{
				totalLeft += 2;
			}
			
			parent = parent.offsetParent;
		}
		
		shadow.style.left = totalLeft + "px";
		shadow.style.top = totalTop + "px";
		
		if (isIE)
		{
			shadow.style.width = subList.offsetWidth - 2 + "px";
			shadow.style.height = subList.offsetHeight - 6 + "px";
		}
		else
		{
			shadow.style.width = subList.offsetWidth + "px";
			shadow.style.height = subList.offsetHeight + 2 + "px";
		}
	}
	catch(error)
	{
	}*/
	
	return true;
}




function hideMenu1()
{
	var self = this;

	menuDelay = setTimeout(function(){hideMenuDelayed(self); return true;}, 500);
	menuDelayTarget = this;
	
	return true;
}




function hideMenuDelayed(menuItem)
{
	//var shadow = document.getElementById("shadow");
	
	if (typeof menuItem.originalClass != "undefined")
	{
		var subListItems = menuItem.getElementsByTagName("li");
	
		menuItem.className = menuItem.originalClass;

		/*if (shadow != null)
		{
			shadow.style.left = "-1500em";
		}*/

	}
	
	return true;
}




function getChildrenByTagName(target, tagName)
{
	if (target == null)
	{
		target = document.getElementById("menuHome");
	}
	
	var children = target.childNodes;
	var matching = new Array();
	
	if (children != null)
	{
		for (var i = 0; i < children.length; i++)
		{
			if (children[i].nodeName.toLowerCase() == tagName)
			{
				matching[matching.length] = children[i];
			}
		}
	}
	
	return matching;
}




/*function debug(debugString)
{
	var debugElement = document.getElementById("debugger");
	
	if (debugElement == null)
	{
		document.getElementsByTagName("body")[0].appendChild(document.createElement("div")).id = "debugger";
		
		debugElement = document.getElementById("debugger");
		
		debugElement.style.position = "absolute";
		debugElement.style.left = "0";
		debugElement.style.top = "0";
	}
	
	debugElement.innerHTML += " " + debugString;
	
	return true;
}*/